package com.cqgc.mapper;

import com.cqgc.pojo.dto.RoleDTO.RoleAddDTO;
import com.cqgc.pojo.dto.RoleDTO.RoleUpdateDTO;
import com.cqgc.pojo.dto.RoleDTO.RoleParm;
import com.cqgc.pojo.entity.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RoleMapper {
    //查询用户信息
    List<Role> pageQuery(RoleParm roleParm);

    //删除角色
    @Delete("delete from role where rid =#{rid}")
    int removeById(int rid);

    //添加角色
    int addRole(RoleAddDTO roleDTO);

    //修改角色信息
    int updateRole(RoleUpdateDTO roleDTO);

    //获取角色下拉数据
    @Select("select * from role")
    List<Role> getRoleInfo();

    @Select("select * from role where name =#{name}")
    Role getOneUpdate(RoleUpdateDTO roleDTO);

    @Select("select * from role where name =#{name}")
    Role getOneAdd(RoleAddDTO roleDTO);

}
